﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Shared/default.master" AutoEventWireup="true" CodeFile="orderdetails.aspx.cs" Inherits="Pages_buy_orderdetails" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<title>填写订单信息</title>
<script type="text/javascript" src="/js/jquery.validate.pack.js"></script>
<script type="text/javascript" src="/js/jquery.jmpopups-0.5.1.js"></script>
<script type="text/javascript" src="/js/buy.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<!--头部文件结束-->
<!--头部文件结束-->
<script type="text/javascript">
    $(function() {
        jQuery.validator.addMethod("isMobile", function(value, element) {
            var length = value.length;
            return this.optional(element) || (length == 11 && /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/.test(value));
        }, "请正确填写您的手机号码");
        jQuery.validator.addMethod("isName", function(value, element) {
            return this.optional(element) || (/^[^0-9]*$/.test(value));
        }, "请正确填写您的姓名");
        $('#aspnetForm').validate({
            rules: {
                amount: {
                    required: true,
                    digits: true,
                    min: 1
                },
                r_name: {
                    isName: true,
                    required: true
                },
                r_mobile: {
                    required: true,
                    minlength: 11,
                    digits: true
                },
                r_address: "required",
                r_date: "required"
            },
            messages: {
                amount: {
                    required: function() { $("#amount_pop_message").html('请输入合法数量'); $("#openlayer1").show(); },
                    digits: function() { $("#amount_pop_message").html('请输入合法数量'); $("#openlayer1").show(); },
                    min: function() { $("#amount_pop_message").html('请最少购买1件商品'); $("#openlayer1").show(); }
                },
                r_name: {
                    isName: "姓名不能为数字，请填写真实姓名",
                    required: "请填写收货人姓名"
                },
                r_mobile: {
                    required: "请填写收货人手机号码",
                    minlength: "请填写合法的手机号码",
                    digits: "请填写合法的手机号码"
                },
                r_address: "请填写收货人地址",
                r_date: {
                    required: function() { alert("请选择发货日期") }
                }
            },
            submitHandler: function(form) {
                if ($("#form_error").val() == 0) {
                    $("#submit_but").attr("disabled", "true");
                    //form.submit();
                    submitOrder();
                }
                else {
                    $("#amount").focus();
                    alert("请填入合法的购买数量");
                }
            }
        });
    })
</script><div class="liuc">
	<div class="liuc_l">
		<div class="l_top"></div>
		<div class="liuc_area">
			<h4><img src="/app_themes/ftuan/images/liucheng1.gif" alt="填写订单" /></h4>
						<div class="liuc_tab01">
				<div class="liuc_tab_piao" id="openlayer1" style="display:none">
					<h5 onclick="javascript:$(this).parent().hide()" style="cursor:pointer"><img src="/app_themes/ftuan/images/close2.gif" /></h5>
					<p id="amount_pop_message"></p>
				</div>
						<div class="liuc_tab_piao3" id="openlayer2" style="display:none">
					<h5 onclick="javascript:$(this).parent().hide()" style="cursor:pointer"><img src="/app_themes/ftuan/images/close2.gif" /></h5>
					<p>该商品您最多可使用M币<em id="coin_limit"><%= productInfo.LimitToken %></em>元</p>
				</div>
						<ul>
					<li class="liuc_tab01_one">产 品</li>
					<li class="liuc_tab01_two">单 价</li>
					<li class="liuc_tab01_three">　</li>
					<li class="liuc_tab01_four">数 量</li>
					<li class="liuc_tab01_five">总 价</li>
				</ul>
				<div class="liuc_tab01_line1"></div>
				<ul>
					<li class="liuc_tab01_six"><%= productInfo.ProductName %></li>
					<li class="liuc_tab01_two f18"><%= string.Format("￥{0}",productInfo.NowPrice.ToString().TrimEnd('0').TrimEnd('.'))%></li>
					<li class="liuc_tab01_three f18">×</li>
					<li class="liuc_tab01_four f18"><input type="text" class="liuc_input3" name="amount" id="amount" value="1" onchange="update_amount()" /></li>
					<li class="liuc_tab01_five f18"><span id="total_price"><%= string.Format("￥{0}",productInfo.NowPrice.ToString().TrimEnd('0').TrimEnd('.'))%></span></li>
				</ul>
				
                <div class="liuc_tab01_line1"></div>
				<ul>
					<li class="liuc_tab01_six"></li>
					<li class="liuc_tab01_two f18"></li>
					<li class="liuc_tab01_three f18"></li>
					<li class="liuc_tab01_seven f12">使用我的M币</li>
					<li class="liuc_tab01_five f18">￥<input type="text" class="liuc_input3" name="coin" id="coin" value='<%= (productInfo.LimitToken<userInfo.TokenAmount)?productInfo.LimitToken:userInfo.TokenAmount %>' onchange="update_coin()" /></li>
				</ul>
				<%--<div class="liuc_tab01_line1"></div>
				<ul>
					<li class="liuc_tab01_six"></li>
					<li class="liuc_tab01_two f18"></li>
					<li class="liuc_tab01_three f18"></li>
					<li class="liuc_tab01_seven f12">快递费</li>
					<li class="liuc_tab01_five f18">￥<%=  productInfo.Freight%></li>
				</ul>
--%>
                <div class="liuc_tab01_line1"></div>
				<ul>
					<li class="liuc_tab01_six"></li>
					<li class="liuc_tab01_two f18"></li>
					<li class="liuc_tab01_three f18"></li>
					<li class="liuc_tab01_seven f12 text5">应付金额</li>
					<li class="liuc_tab01_five f18 text5">￥<span id="pay_total"><%=  productInfo.NowPrice - ((productInfo.LimitToken < userInfo.TokenAmount) ? productInfo.LimitToken : userInfo.TokenAmount)%></span></li>
				</ul>
				<div class="clear"></div>
			</div>
			<div class="blank10"></div>
<script type="text/javascript"> 
<!--
    function r_name_Empty() {
        var r_name = $('#r_name').val();
        if (r_name == "如：张飞") {
            $('#r_name').val('');
        }
    }
    function r_mobile_Empty() {
        var r_mobile = $('#r_mobile').val();
        if (r_mobile == "如：13801234567") {
            $('#r_mobile').val('');
        }
    }
    function r_address_Empty() {
        var r_address = $('#r_address').val();
        if (r_address == "如：广州区天河东路50号   邮编:510000") {
            $('#r_address').val('');
        }
    }
//-->
</script>
	
<input type="hidden" value="252" name="hidden_uid" id="hidden_uid"/>
			<div class="liuc_tab02" id="r_open_address">
			<dl>
				<dt id="dt_name">您的姓名:</dt>
				<dd><input id="r_name" name="r_name" type="text" class="liuc_input1" value=""  /></dd>
				<em class="text5" id="liuc_tab01">身份证是您到店消费的凭证</em>
			</dl>
			<dl>
				<dt id="dt_mobile">您的手机:</dt>
				<dd><input id="r_mobile" name="r_mobile" type="text" class="liuc_input1" value=""  maxlength="11"/></dd>
				<em id="liuc_tab02">请正确填写您的手机号，及时获得发货通知或消费通知！</em>
			</dl>
			<dl style='<%= (Convert.ToBoolean(productInfo.Carrying))?"display:block":"display:none"%>'> 
				<dt id="dt_address">您的地址:</dt>
				<dd><input id="r_address" name="r_address" type="text" class="liuc_input2" value="如：广州区天河东路50号   邮编:510000" onclick="r_address_Empty()"/></dd>
			</dl>

			
		</div> 
			<div class="blank10"></div>
						<div class="liuc_tab_but"><input type="submit" class="liuc_but1" id="submit_but" value="确认" /></div>
		</div>
		<div class="l_bot"></div>
	</div>
	<div class="liuc_r">
		<div class="liuc_r_cont1" id="friends_address">
			<h3>我要送给朋友</h3>
			<p>请<em><a href="javascript:void(0)" onclick="friend_address()">点击这里</a></em></p>
		</div>
		<div class="liuc_r_cont1" style="display: none;" id="self_address">
			<h3>我要买给自己</h3>
			<p>请<em><a href="javascript:void(0)" onclick="self_address()">点击这里</a></em></p>
		</div>
		<div class="blank25"></div>
				<div class="liuc_r_cont2">
			<p><em class="text5" ><%=userInfo.TokenAmount%></em>元</p>
		</div>
			</div>
	<input type="hidden" id="pid" name="pid" value='<%=  productInfo.ProductID%>' />
	<input type="hidden" id="price" name="price" value='<%= productInfo.NowPrice%>' />
	<input type="hidden" id="pname" name="pname" value='<%= productInfo.ProductName%>' />
	
	
	<input type="hidden" id="maxtoken" name="maxtoken" value='<%= productInfo.LimitToken%>' />
	<input type="hidden" id="mytoken" name="mytoken" value='<%=userInfo.TokenAmount%>' />
	<input type="hidden" id="uid" name="uid" value='<%=userInfo.UserID%>' />
	<input type="hidden" id="form_error" name="form_error" value="0" />
</div>
</asp:Content>
